// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package pica.ui;

import java.util.*;
import javax.microedition.lcdui.*;

public final class f
{

    public f()
    {
    }

    public static final String a(Date date, boolean flag)
    {
        Calendar calendar;
        (calendar = Calendar.getInstance()).setTime(date);
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append(Integer.toString(calendar.get(1)) + "\u5E74");
        a(stringbuffer, calendar.get(2) + 1, "\u6708");
        a(stringbuffer, calendar.get(5), "\u65E5 ");
        if(flag)
        {
            a(stringbuffer, calendar.get(11), ":");
            a(stringbuffer, calendar.get(12), "");
        }
        return stringbuffer.toString();
    }

    private static final void a(StringBuffer stringbuffer, int i, String s)
    {
        int j = stringbuffer.length();
        stringbuffer.append(Integer.toString(i));
        if(stringbuffer.length() - j == 1)
            stringbuffer.insert(stringbuffer.length() - 1, "0");
        stringbuffer.append(s);
    }

    public static String[] a(String s, int i, Font font)
    {
        int j = 0;
        int k = 1;
        s.length();
        char ac[] = null;
        ac = s.toCharArray();
        Vector vector = new Vector();
        int l = 0;
        for(int i1 = 0; i1 < s.length(); i1++)
        {
            if(ac[i1] == '\n')
            {
                j = 0;
                k++;
                vector.addElement(s.substring(l, i1));
                l = i1 + 1;
                continue;
            }
            if(i - j < font.charWidth(ac[i1]))
            {
                j = 0;
                k++;
                vector.addElement(s.substring(l, i1));
                l = i1;
            }
            j += font.charWidth(ac[i1]);
        }

        vector.addElement(s.substring(l));
        String as[] = new String[k];
        for(int j1 = 0; j1 < vector.size(); j1++)
            as[j1] = (String)vector.elementAt(j1);

        return as;
    }

    public static boolean a(int i, int j, int k, int l, int i1, int j1)
    {
        return i >= k && i <= k + i1 && j >= l && j <= l + j1;
    }

    public static void a(String s, int i, int j, int k, int l, int i1, Graphics g)
    {
        g.setColor(l);
        g.drawString(s, i - 1, j, i1);
        g.drawString(s, i + 1, j, i1);
        g.drawString(s, i, j - 1, i1);
        g.drawString(s, i, j + 1, i1);
        g.drawString(s, i - 1, j - 1, i1);
        g.drawString(s, i + 1, j + 1, i1);
        g.drawString(s, i - 1, j + 1, i1);
        g.drawString(s, i + 1, j - 1, i1);
        g.setColor(k);
        g.drawString(s, i, j, i1);
    }

    public static final boolean a(String s)
    {
        return s == null || s.length() != 11 || !s.startsWith("1");
    }

    public static final boolean b(String s)
    {
        if(s == null || s.length() == 0)
            return true;
        int i = s.length();
        for(int j = 0; j < i; j++)
        {
            char c;
            if(((c = s.charAt(j)) < '0' || c > '9') && (c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && c != '_')
                return true;
        }

        return false;
    }

    public static final void a(Image image, int i, int j, int k, int l, int i1, Graphics g)
    {
        int j1 = image.getWidth() / k;
        int k1 = i1 % j1;
        int l1 = (i1 - k1) / j1;
        int i2 = g.getClipX();
        int j2 = g.getClipY();
        int k2 = g.getClipWidth();
        int l2 = g.getClipHeight();
        g.setClip(i, j, k, l);
        g.drawImage(image, i - k1 * k, j - l1 * l, 0);
        g.setClip(i2, j2, k2, l2);
    }

    public static String a(int i, int j)
    {
        StringBuffer stringbuffer;
        if((stringbuffer = new StringBuffer(String.valueOf(i))).length() < 6)
            for(; stringbuffer.length() < 6; stringbuffer.insert(0, "0"));
        if(stringbuffer.length() - 6 == 0)
            stringbuffer.insert(stringbuffer.length() - 6, "0.");
        else
            stringbuffer.insert(stringbuffer.length() - 6, ".");
        if(j <= 0)
            stringbuffer.delete(stringbuffer.toString().indexOf("."), stringbuffer.length());
        else
        if(stringbuffer.toString().indexOf(".") + j + 1 < stringbuffer.length())
        {
            stringbuffer.delete(stringbuffer.toString().indexOf(".") + j + 1, stringbuffer.length());
            for(int k = 0; k < j && stringbuffer.charAt(stringbuffer.length() - 1) == '0'; k++)
                stringbuffer.deleteCharAt(stringbuffer.length() - 1);

            if(stringbuffer.charAt(stringbuffer.length() - 1) == '.')
                stringbuffer.deleteCharAt(stringbuffer.length() - 1);
        }
        return stringbuffer.toString();
    }

    public static String a(String s, String s1, String s2)
    {
        int i;
        if((i = s.indexOf(s1)) > -1)
        {
            StringBuffer stringbuffer;
            (stringbuffer = new StringBuffer(s)).delete(i, i + s1.length());
            stringbuffer.insert(i, s2);
            return stringbuffer.toString();
        } else
        {
            return s;
        }
    }
}
